#pragma once

const float PI = 3.141592653589732f;

struct Vector2D
{
	float X;
	float Y;

	Vector2D operator+(const Vector2D& v)
	{
		Vector2D r = { X + v.X, Y + v.Y };
		return r;
	}

	Vector2D operator-(const Vector2D& v)
	{
		Vector2D r = { X - v.X, Y - v.Y };
		return r;
	}

	Vector2D operator*(const float f)
	{
		Vector2D r = { X * f, Y * f };
		return r;
	}

	Vector2D operator/(const float f )
	{
		Vector2D r = { X / f, Y / f };
		return r;
	}
};

//	Find the length of a vector (magnitude)
float Vector2DLength(Vector2D vec);

// Find the dot product
float DotProduct(Vector2D v1, Vector2D v2);

//	Normalize a vector
Vector2D Vector2DNormalize(Vector2D vec);

//	Rotate a vector
/*
	X, Y	=	[X]
				[Y]
				[1]

	[	cos&	sin&	0	]		[X]		[X1]
	[  -sin&	cos&	0	]	*	[Y]	=	[Y1]
	[	0		0		1	]		[1]		[1]
*/
Vector2D Vector2DRotate(Vector2D vec, float fRadians);

//	Find the angle between 2 vectors
/*
	a . b = (||a|| ||b||) cos @

	cos @ = (a . b) / (||a|| ||b||)

	@ = arccos (a.b)
*/
float AngleBetweenVectors(Vector2D v1, Vector2D v2);

//	Linear Interpolation
//	v = a + ((b - a) * t)
float Lerp(float fStart, float fEnd, float fPercent);

//	Tests if two floats are approximately equal given a margin of error
bool FloatEquals(float fResult, float fExpected, float fEpsilon = 0.001f);

//	Determines which way to turn (counter clockwise (+) or clockwise (-))
float Steering(Vector2D vOrientation, Vector2D vToTarget);

float Round(float number);

bool IntersectCircle(const Vector2D& first, const float& firstradius, const Vector2D& second, const float& secondradius);